{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t42RET0fjHsCAW5WRwzTr/w6\n"
     ]
    }
   ],
   "source": [
    "from selenium import webdriver\n",
    "from time import sleep\n",
    "from selenium.webdriver.common.action_chains import ActionChains\n",
    "from selenium.webdriver.common.keys import Keys\n",
    "import requests\n",
    "\n",
    "browser = webdriver.Chrome()\n",
    "# browser = webdriver.Firefox()\n",
    "url = \"http://www.alimama.com/\"\n",
    "browser.get(url)\n",
    "# browser.delete_all_cookies()\n",
    "# print browser.get_cookies()\n",
    "\n",
    "# cookie_str = 'cookie2@@@bba52d7e132fff4aa7656f0d5e74dcec;_tb_token_@@@tSFH1EYL8Ebq;t@@@41ae437de71e668701a4745829b4adda;v@@@0;cookie32@@@952c9fd643ed13cea5c39990efc48139;cookie31@@@Njg4NjkyNDAsbWVpbHl4aWFvLDI5MzM0Mjc2QHFxLmNvbSxUQg%3D%3D;alimamapwag@@@TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D;login@@@UtASsssmOIJ0bQ%3D%3D;alimamapw@@@DFwKDxwcUQQOOAVTU1FTBwQHUVtWVFxWWwNRUgZRBFYHVwQBBw1SBwAG;cna@@@nWiREW5xjFUCAW5WRwwo4Yu1;apushdbc5b1e1a2706414bbd2605f4029a333@@@%7B%22ts%22%3A1493859022041%2C%22parentId%22%3A1493859022037%7D'\n",
    "# for cookie in cookie_str.split(';'):\n",
    "#     name,value = cookie.split('@@@')\n",
    "#     if name in ('cookie2','alimamapwag','alimamapw'):\n",
    "#         browser.add_cookie({'name':name,'value':value,'httpOnly': True,'domain':'.alimama.com'})\n",
    "#     else:\n",
    "#         browser.add_cookie({'name':name,'value':value,'httpOnly': False,'domain':'.alimama.com'})\n",
    "\n",
    "\n",
    "cookies = browser.get_cookies()\n",
    "for cookie in cookies:\n",
    "    if str(cookie['name']) == 'cna':\n",
    "        print cookie['value']\n",
    "\n",
    "# url = 'http://www.alimama.com/'\n",
    "# browser.get(url)\n",
    "# sleep(2)\n",
    "# print '2:',browser.get_cookies()\n",
    "\n",
    "# # url = 'http://pub.alimama.com/report/getTbkPaymentDetails.json?&queryType=1&payStatus=&DownloadID=DOWNLOAD_REPORT_INCOME_NEW&startTime=2017-05-04&endTime=2017-05-04'\n",
    "# # browser.get(url)\n",
    "# url = 'https://market.m.taobao.com/apps/aliyx/coupon/detail.html?wh_weex=true&activity_id=0ad0e948a95848589bb386c039255e17&seller_id=3091520751'\n",
    "# browser.get(url)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
